﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Inmobiliaria.Presenters.WFPresenters;
using Inmobiliaria.Presenters.ViewInterfaces;
using Inmobiliaria.Services.Core.DTO;
using System.Drawing;
using System.IO;

public partial class InmobiliariasWF : System.Web.UI.Page, IViewConsultarInmobiliarias
{
    IViewConsultarInmobiliarias viewConsultarInmobiliarias;
    ConsultarInmobiliariasPresenter _presenter;
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            _presenter = new ConsultarInmobiliariasPresenter(this);
            _presenter.ConsultarInmobiliarias();
        }
        catch (Exception ex)
        {
        }
    }
    #region IViewInmobiliaria Members

    public List<DtoInmobiliaria> listarInmobiliaria
    {
        set
        {
            for (int j = 0; j < value.Count; j++)
            {
                string nombreInmobiliaria = "Label" + j + "";
                string sitioWeb = "Label" + j + "";

                string nombre = "ImageButton" + j + "";
                ImageButton control = (ImageButton)this.Master.FindControl("Form1").FindControl("MainContent").FindControl(nombre);
                Label controlLabel = (Label)this.Master.FindControl("Form1").FindControl("MainContent").FindControl(nombreInmobiliaria);
                
                control.ImageUrl = System.Configuration.ConfigurationManager.AppSettings.Get("ConsultarImagenesInmobiliaria").ToString() + value[j].IdInmobiliaria + "-" + value[j].NombreInmobiliaria + ".jpg";
                
                control.Visible = controlLabel.Visible = true;
                controlLabel.Text = value[j].NombreInmobiliaria;
                //Label controlLabelSitioWeb = (Label)this.Master.FindControl("Form1").FindControl("MainContent").FindControl(sitioWeb);
                //if (value[j].SitioWeb != "")
                //{
                //    controlLabelSitioWeb.Visible = true;
                //    controlLabelSitioWeb.Text = value[j].SitioWeb;
                //}

                if (j == 12)
                    break;
            }
        }
    }
    #endregion
    #region Mensajes
    public void ShowMessage(string message)
    {
        throw new NotImplementedException();
    }
    public void Error(string message)
    {
        // MostrarMensajeDialogo(Enumeraciones.TipoDeMensaje.Informacion, message);
    }
    public void ShowError(Exception ex)
    {
        throw new NotImplementedException();
    }
    public void ShowQuestion(string message)
    {
        throw new NotImplementedException();
    }
    #endregion
    protected void ImageButton0_Click(object sender, ImageClickEventArgs e)
    {

    }
}